<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 打印出1000-2000年中所有的闰年，并以每行四个数的形式输出
        // 初始值 1000，条件 <=2000 ; if 筛选闰年
        var a = 1000;
        var count = 1;
        for (a; a <= 2000; a++) {
            if (a % 4 == 0 && a % 100 != 0 || a % 400 == 0) {
                if(count % 4 !==0){
                    document.write(`${a}&nbsp;`)
                }
                else{
                    document.write(`${a}<br>`)
                }
                count++
            }
        }
    </script>
</body>

</html>